package com.xpec.c4.db.model.basic;

import java.util.concurrent.ConcurrentHashMap;

public  class SlotBasicDBManager 
{
	public static String TRIAL = "TRIAL";
	
	public static String NORMAL = "NORMAL";	
	
	protected static ConcurrentHashMap<String,GameSealUpModel> sealup = new ConcurrentHashMap<String,GameSealUpModel>();
	
	/**
	 * 是否要做清水
	 */
	public static boolean isDoSealUp = true;
	
	/**
	 * 讀取封存資料
	 * @param seatid
	 * @return
	 */
	public static GameSealUpModel getSeatlUpLog(String gameid , String halltype , String seatid)
	{
		GameSealUpModel mm= null;
		
		String key = gameid+"_"+halltype+"_"+seatid;
		if(sealup.containsKey(key))
		{
			mm = sealup.remove(key);
		}
		
		return mm;
	}
	
	public static void putSeatlUpLog(GameSealUpModel model,String gameid , String halltype , String seatid)
	{
		String key = gameid+"_"+halltype+"_"+seatid;
		if(sealup.containsKey(key))
		{
			return;
		}
		
		sealup.put(key, model);
	}
	
	
	/**
	 * 新增封存log
	 * @param fmodel
	 * @param gameid
	 * @param sealupType
	 */
	public static void addSealUpLog(SlotBasicGameModel fmodel , String gameid , String sealupType) 
	{
		GameSealUpModel smodel = new GameSealUpModel();
		smodel.setSeatid(fmodel.getDb_id());
		smodel.setGameid(gameid);
		smodel.setHalltype(fmodel.getHalltype());
		smodel.setMachineNumber(fmodel.getMachineid());
		smodel.setSealuptype(sealupType);
	
		smodel.setAllbet(fmodel.getAllbet());
		smodel.setAllincome(fmodel.getAllincome());
		smodel.setAllpayout(fmodel.getAllpayout());
		smodel.setAllspin(fmodel.getAllspin());
		smodel.setBetToJpSum(fmodel.getBetToJpSum());
		smodel.setJpPayoutSum(fmodel.getJpPayoutSum());
		
		smodel.setIncome(fmodel.getIncome());
		smodel.setTotalbet(fmodel.getTotalbet());
		smodel.setPayout(fmodel.getPayout());
		smodel.setWaterpool(fmodel.getWaterpool());
		smodel.setWaterpool_feedback(fmodel.getWaterpool_feedback());
		smodel.setWaterpool_range(fmodel.getWaterpool_range());
		
		
		smodel.setPourBase(fmodel.getPourBase());
		smodel.setPourStart(fmodel.getPourStart());
		smodel.setPourTotal(fmodel.getPourTotal());
		smodel.setPourState(fmodel.getPourState());
		
		smodel.setRookie_pourBase(fmodel.getRookie_pourBase());
		smodel.setRookie_pourStart(fmodel.getRookie_pourStart());
		smodel.setRookie_pourTotal(fmodel.getRookie_pourTotal());
		smodel.setRookie_pourState(fmodel.getRookie_pourState());
		smodel.setRookie_waterpool(fmodel.getRookie_waterpool());
		smodel.setRookie_waterpool_feedback(fmodel.getRookie_waterpool_feedback());
		smodel.setRookie_waterpool_range(fmodel.getRookie_waterpool_range());
		
		smodel.setTrialalltotalbet(fmodel.getTrialallbet());
		smodel.setTrialallincome(fmodel.getTrialallincome());
		smodel.setTrialallpayout(fmodel.getTrialallpayout());
		smodel.setTrialallspin(fmodel.getTrialallspin());
		
		smodel.setTrialtotalbet(fmodel.getTrialbet());
		smodel.setTrialincome(fmodel.getTrialincome());
		smodel.setTrialpayout(fmodel.getTrialpayout());
		
		smodel.setTrialpourBase(fmodel.getTrialpourBase());
		smodel.setTrialpourStart(fmodel.getTrialpourStart());
		smodel.setTrialpourTotal(fmodel.getTrialpourTotal());
		smodel.setTrialpourState(fmodel.getTrialpourState());
		smodel.setTrialwaterlevel(fmodel.getTrialwaterpool());
		smodel.setTrialwaterpool_feedback(fmodel.getTrialwaterpool_feedback());
		smodel.setTrialwaterpool_range(fmodel.getTrialwaterpool_range());
		
		smodel.setItemalltotalbet(fmodel.getItemallbet());
		smodel.setItemallincome(fmodel.getItemallincome());
		smodel.setItemallpayout(fmodel.getItemallpayout());
		smodel.setItemallspin(fmodel.getItemallspin());
		smodel.setItemtotalbet(fmodel.getItembet());
		smodel.setItempayout(fmodel.getItempayout());
		smodel.setItemincome(fmodel.getItemincome());		
		
		//加入封存log
		SlotBasicDBManager.putSeatlUpLog(smodel, gameid, fmodel.getHalltype(), fmodel.getDb_id());
	}
}
